package com.yilin.tms.core.entity.user.organize;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yilin.tms.core.commons.base.BaseEntity;
import com.yilin.tms.core.commons.model.AuthStatus;
import com.yilin.tms.core.entity.capital.BankCard;
import com.yilin.tms.core.entity.system.applets.H5Applets;
import com.yilin.tms.core.entity.user.account.Account;
import com.yilin.tms.core.entity.user.OrganType;
import com.yilin.tms.core.entity.user.UserType;
import com.yilin.tms.core.entity.user.account.UserAccrual;
import lombok.Getter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Entity
@Table(name = "user_organize")
@TableName("user_organize")
public class Organize extends BaseEntity {

    //代开协议签订状态
    public enum AgencySignState {
        none(0, "无需签订"),
        notSigned(1, "未签订"),
        signed(2, "已签订");
        @EnumValue
        public Integer index;
        public String name;

        AgencySignState(Integer index, String name) {
            this.index = index;
            this.name = name;
        }
    }

    @Column(name = "organ_type")
    private OrganType organType;//组织类型
    @Column(name = "user_type")
    private UserType userType;//用户类型
    @Column(name = "authorized")
    private Boolean authorized=false;//是否属于授权用户
    @Column(name = "authorized_state")//组织状态
    private Account.UserState authorizedState= Account.UserState.enable;//是否属于授权用户
    @Column(name = "truck_number")
    private Double truckNumber;//允许的绑定车辆的数量 公司特定
    @TableLogic
    @Column(name = "is_deleted", columnDefinition = "INT default 0")
    private Integer isDeleted;//逻辑删除

    //组织信息，个人信息/公司信息
    @Column(name = "organize_name")
    private String organizeName;//组织名称
    @Column(name = "organize_logo")
    private String organizeLogo;//组织logo
    @Column(name = "organize_tel")
    private String organizeTel;//组织电话
    @Column(name = "introduction")
    private String introduction;//公司介绍
    @Column(name = "signature_img")
    private String signatureImg;//印章/签名
    @Column(name = "signature_id")
    private String signatureId;//印章 id
    //组织的e签宝-签名信息
    @Column(name = "e_sing_treasure_Id")
    private String eSingTreasureId;
    @Column(name = "agency_sign_state")
    private AgencySignState agencySignState;//代开协议签订状态，个体车主需
    @Column(name = "agency_sign_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date agencySignTime;//代开协议签订时间
    //企业时：公司信息
    @Column(name = "legal_name")
    private String legalName;//法人名称
    @Column(name = "legal_phone")
    private String legalPhone;//法人手机号
    @Column(name = "address")
    private String address;  //联系地址

    //管理员/对应组织顶层管理
    @Column(name = "manager_user_id")
    private String managerUserId;//管理员ID
    @Column(name = "manager_user_name")
    private String managerUserName;//管理员名称
    @Column(name = "manager_user_phone")
    private String managerUserPhone;//管理员电话
    @Column(name = "manager_user_email")
    private String managerUserEmail;//管理员邮箱  ****必填
    @Column(name = "manager_user_avatar")
    private String managerUserAvatar;//管理员头像
    //上级平台信息 直属运营平台
    @Column(name = "superior_plat_organize_id")
    private String superiorPlatOrganizeId; //绑定公司ID
    @Column(name = "superior_plat_organize_name")
    private String superiorPlatOrganizeName; //绑定公司组织名称
    //上级集团组织
    @Column(name = "group_organize_id")
    private String groupOrganizeId;//组织ID
    @Column(name = "group_organize_name")
    private String groupOrganizeName;//组织名称
    @Column(name = "group_organize_manager_user_id")
    private String groupOrganizeManagerUserId;//组织管理员用户ID
    @Column(name = "group_organize_manager_user_name")
    private String groupOrganizeManagerUserName;//组织管理员用户名称
    @Column(name = "group_organize_apply_time")
    private Date groupOrganizeApplyTime; //申请加入集团时间
    //会员信息：会员信息仅组织生效
    @Column(name = "member_type_id")
    private String memberTypeId;//会员
    @Column(name = "member_type_name")
    private String memberTypeName;//会员名称

    //评分-->每个月月底，通过组织员工信用分情况为其组织评分 60-120，
    //低于三个员工，取平均值，等于高于三个员工，去掉一个最高分，去掉一个最低分，再取平均值，防止极端刷分
    @Column(name = "monthly_rating")
    private Double monthlyRating;//月度评分
    @Column(name = "monthly_rating_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date monthlyRatingTime;//月度评分
    //平台作为增值服务虚拟累加的平台货币，如QQ的Q币，点券等，每完成一单，给1-10个币，与人民币兑率10:1
    @Column(name = "virtual_coin")
    private Integer virtualCoin;  //平台币/积分

    //查询字段
    @Transient
    @TableField(exist = false)
    private List<Account> employeeList;//团队列表
    @Transient
    @TableField(exist = false)
    private List<Organize> children;//子组织列表

    @Transient
    @TableField(exist = false)
    private String queryOrganizeIds; //查询ID集
    @Transient
    @TableField(exist = false)
    private String ownTruckTypeNames = ""; //拥有车型名称
    @Transient
    @TableField(exist = false)
    private Cooperate.CooperateState cooperateState;//是否合作【与请求者】
    @Transient
    @TableField(exist = false)
    private Integer employeeCount = 1; //员工数量
    @Transient
    @TableField(exist = false)
    private int businessCount;//组织下的运单量 create:zjy 2022/7/13
    @Transient
    @TableField(exist = false)
    private int clearCount;//待清算运单量 create:zjy 2022/7/13

    @Transient
    @TableField(exist = false)
    private List<Map<String,Object>> tradingTrendData;//交易趋势
    @Transient
    @TableField(exist = false)
    private Map<String,Object> creditAssetsData;//信用资产

    @Transient
    @TableField(exist = false)
    private int totalGoodAppraiseCount = 0; //好评 4-5
    @Transient
    @TableField(exist = false)
    private int totalMidAppraiseCount = 0;//中评 2.5-3.5
    @Transient
    @TableField(exist = false)
    private int totalBadAppraiseCount = 0;//差评 1 2
    @Transient
    @TableField(exist = false)
    private int totalComplaintsCount = 0;//被投诉
    @Transient
    @TableField(exist = false)
    private int totalArbitrationCount = 0;//仲裁惩罚
    @Transient
    @TableField(exist = false)
    private int totalViolationCount = 0;//违规
    @Transient
    @TableField(exist = false)
    private String bindBankCardName ;//是否绑定银行卡名称
    @Transient
    @TableField(exist = false)
    private String bindBankCardNo ;//绑定银行卡号

    public Account.UserState getAuthorizedState() {
        return authorizedState;
    }

    public void setAuthorizedState(Account.UserState authorizedState) {
        this.authorizedState = authorizedState;
    }

    public Boolean getAuthorized() {
        return authorized;
    }

    public void setAuthorized(Boolean authorized) {
        this.authorized = authorized;
    }

    public Double getTruckNumber() {
        return truckNumber;
    }

    public void setTruckNumber(Double truckNumber) {
        this.truckNumber = truckNumber;
    }

    public String getManagerUserAvatar() {
        return managerUserAvatar;
    }

    public void setManagerUserAvatar(String managerUserAvatar) {
        this.managerUserAvatar = managerUserAvatar;
    }

    public int getTotalGoodAppraiseCount() {
        return totalGoodAppraiseCount;
    }

    public void setTotalGoodAppraiseCount(int totalGoodAppraiseCount) {
        this.totalGoodAppraiseCount = totalGoodAppraiseCount;
    }

    public int getTotalMidAppraiseCount() {
        return totalMidAppraiseCount;
    }

    public void setTotalMidAppraiseCount(int totalMidAppraiseCount) {
        this.totalMidAppraiseCount = totalMidAppraiseCount;
    }

    public int getTotalBadAppraiseCount() {
        return totalBadAppraiseCount;
    }

    public void setTotalBadAppraiseCount(int totalBadAppraiseCount) {
        this.totalBadAppraiseCount = totalBadAppraiseCount;
    }

    public int getTotalComplaintsCount() {
        return totalComplaintsCount;
    }

    public void setTotalComplaintsCount(int totalComplaintsCount) {
        this.totalComplaintsCount = totalComplaintsCount;
    }

    public int getTotalArbitrationCount() {
        return totalArbitrationCount;
    }

    public void setTotalArbitrationCount(int totalArbitrationCount) {
        this.totalArbitrationCount = totalArbitrationCount;
    }

    public int getTotalViolationCount() {
        return totalViolationCount;
    }

    public void setTotalViolationCount(int totalViolationCount) {
        this.totalViolationCount = totalViolationCount;
    }

    public OrganType getOrganType() {
        return organType;
    }

    public void setOrganType(OrganType organType) {
        this.organType = organType;
    }

    public UserType getUserType() {
        return userType;
    }

    public void setUserType(UserType userType) {
        this.userType = userType;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public String getOrganizeName() {
        return organizeName;
    }

    public void setOrganizeName(String organizeName) {
        this.organizeName = organizeName;
    }

    public String getOrganizeLogo() {
        return organizeLogo;
    }

    public void setOrganizeLogo(String organizeLogo) {
        this.organizeLogo = organizeLogo;
    }

    public String getOrganizeTel() {
        return organizeTel;
    }

    public void setOrganizeTel(String organizeTel) {
        this.organizeTel = organizeTel;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public String getSignatureImg() {
        return signatureImg;
    }

    public void setSignatureImg(String signatureImg) {
        this.signatureImg = signatureImg;
    }

    public String getSignatureId() {
        return signatureId;
    }

    public void setSignatureId(String signatureId) {
        this.signatureId = signatureId;
    }

    public String geteSingTreasureId() {
        return eSingTreasureId;
    }

    public void seteSingTreasureId(String eSingTreasureId) {
        this.eSingTreasureId = eSingTreasureId;
    }

    public AgencySignState getAgencySignState() {
        return agencySignState;
    }

    public void setAgencySignState(AgencySignState agencySignState) {
        this.agencySignState = agencySignState;
    }

    public Date getAgencySignTime() {
        return agencySignTime;
    }

    public void setAgencySignTime(Date agencySignTime) {
        this.agencySignTime = agencySignTime;
    }

    public String getLegalName() {
        return legalName;
    }

    public void setLegalName(String legalName) {
        this.legalName = legalName;
    }

    public String getLegalPhone() {
        return legalPhone;
    }

    public void setLegalPhone(String legalPhone) {
        this.legalPhone = legalPhone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getManagerUserId() {
        return managerUserId;
    }

    public void setManagerUserId(String managerUserId) {
        this.managerUserId = managerUserId;
    }

    public String getManagerUserName() {
        return managerUserName;
    }

    public void setManagerUserName(String managerUserName) {
        this.managerUserName = managerUserName;
    }

    public String getManagerUserPhone() {
        return managerUserPhone;
    }

    public void setManagerUserPhone(String managerUserPhone) {
        this.managerUserPhone = managerUserPhone;
    }

    public String getManagerUserEmail() {
        return managerUserEmail;
    }

    public void setManagerUserEmail(String managerUserEmail) {
        this.managerUserEmail = managerUserEmail;
    }

    public String getSuperiorPlatOrganizeId() {
        return superiorPlatOrganizeId;
    }

    public void setSuperiorPlatOrganizeId(String superiorPlatOrganizeId) {
        this.superiorPlatOrganizeId = superiorPlatOrganizeId;
    }

    public String getSuperiorPlatOrganizeName() {
        return superiorPlatOrganizeName;
    }

    public void setSuperiorPlatOrganizeName(String superiorPlatOrganizeName) {
        this.superiorPlatOrganizeName = superiorPlatOrganizeName;
    }

    public String getGroupOrganizeId() {
        return groupOrganizeId;
    }

    public void setGroupOrganizeId(String groupOrganizeId) {
        this.groupOrganizeId = groupOrganizeId;
    }

    public String getGroupOrganizeName() {
        return groupOrganizeName;
    }

    public void setGroupOrganizeName(String groupOrganizeName) {
        this.groupOrganizeName = groupOrganizeName;
    }

    public String getGroupOrganizeManagerUserId() {
        return groupOrganizeManagerUserId;
    }

    public void setGroupOrganizeManagerUserId(String groupOrganizeManagerUserId) {
        this.groupOrganizeManagerUserId = groupOrganizeManagerUserId;
    }

    public String getGroupOrganizeManagerUserName() {
        return groupOrganizeManagerUserName;
    }

    public void setGroupOrganizeManagerUserName(String groupOrganizeManagerUserName) {
        this.groupOrganizeManagerUserName = groupOrganizeManagerUserName;
    }

    public Date getGroupOrganizeApplyTime() {
        return groupOrganizeApplyTime;
    }

    public void setGroupOrganizeApplyTime(Date groupOrganizeApplyTime) {
        this.groupOrganizeApplyTime = groupOrganizeApplyTime;
    }

    public String getMemberTypeId() {
        return memberTypeId;
    }

    public void setMemberTypeId(String memberTypeId) {
        this.memberTypeId = memberTypeId;
    }

    public String getMemberTypeName() {
        return memberTypeName;
    }

    public void setMemberTypeName(String memberTypeName) {
        this.memberTypeName = memberTypeName;
    }

    public Double getMonthlyRating() {
        return monthlyRating;
    }

    public void setMonthlyRating(Double monthlyRating) {
        this.monthlyRating = monthlyRating;
    }

    public Date getMonthlyRatingTime() {
        return monthlyRatingTime;
    }

    public void setMonthlyRatingTime(Date monthlyRatingTime) {
        this.monthlyRatingTime = monthlyRatingTime;
    }

    public Integer getVirtualCoin() {
        return virtualCoin;
    }

    public void setVirtualCoin(Integer virtualCoin) {
        this.virtualCoin = virtualCoin;
    }

    public String getQueryOrganizeIds() {
        return queryOrganizeIds;
    }

    public void setQueryOrganizeIds(String queryOrganizeIds) {
        this.queryOrganizeIds = queryOrganizeIds;
    }

    public Integer getEmployeeCount() {
        return employeeCount;
    }

    public void setEmployeeCount(Integer employeeCount) {
        this.employeeCount = employeeCount;
    }

    public String getOwnTruckTypeNames() {
        return ownTruckTypeNames;
    }

    public void setOwnTruckTypeNames(String ownTruckTypeNames) {
        this.ownTruckTypeNames = ownTruckTypeNames;
    }

    public Cooperate.CooperateState getCooperateState() {
        return cooperateState;
    }

    public void setCooperateState(Cooperate.CooperateState cooperateState) {
        this.cooperateState = cooperateState;
    }

    public int getBusinessCount() {
        return businessCount;
    }

    public void setBusinessCount(int businessCount) {
        this.businessCount = businessCount;
    }

    public int getClearCount() {
        return clearCount;
    }

    public void setClearCount(int clearCount) {
        this.clearCount = clearCount;
    }

    public List<Account> getEmployeeList() {
        return employeeList;
    }

    public void setEmployeeList(List<Account> employeeList) {
        this.employeeList = employeeList;
    }

    public List<Organize> getChildren() {
        return children;
    }

    public void setChildren(List<Organize> children) {
        this.children = children;
    }

    public List<Map<String, Object>> getTradingTrendData() {
        return tradingTrendData;
    }

    public void setTradingTrendData(List<Map<String, Object>> tradingTrendData) {
        this.tradingTrendData = tradingTrendData;
    }

    public Map<String, Object> getCreditAssetsData() {
        return creditAssetsData;
    }

    public void setCreditAssetsData(Map<String, Object> creditAssetsData) {
        this.creditAssetsData = creditAssetsData;
    }


    public String getBindBankCardName() {
        return bindBankCardName;
    }

    public void setBindBankCardName(String bindBankCardName) {
        this.bindBankCardName = bindBankCardName;
    }

    public String getBindBankCardNo() {
        return bindBankCardNo;
    }

    public void setBindBankCardNo(String bindBankCardNo) {
        this.bindBankCardNo = bindBankCardNo;
    }
}
